package SubSystem;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.io.IOException;
public class SubSystemWR {
    private static final String FILE_PATH = "class_12_facade//src//file.text";

    //写文件
    public void writeText(String text){
        try {
            Files.write(Paths.get(FILE_PATH), text.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
        }catch (IOException e) {
            e.printStackTrace();
        }
    }

    //读文件
    public String readText() {
        try {
            byte[] encoded = Files.readAllBytes(Paths.get(FILE_PATH));
            String encryptedData = new String(encoded);
            return encryptedData;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
